package infb.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "DOLENCIAS")
@NamedQueries({@NamedQuery(name = "Dolencias.findAll", query = "SELECT d FROM Dolencias d"), @NamedQuery(name = "Dolencias.findById", query = "SELECT d FROM Dolencias d WHERE d.id = :id"), @NamedQuery(name = "Dolencias.findByFecha", query = "SELECT d FROM Dolencias d WHERE d.fecha = :fecha"), @NamedQuery(name = "Dolencias.findByTexto", query = "SELECT d FROM Dolencias d WHERE d.texto = :texto"), @NamedQuery(name = "Dolencias.findByAtendida", query = "SELECT d FROM Dolencias d WHERE d.atendida = :atendida")})
@SequenceGenerator(name="secuencia_dolencias",sequenceName="SECUENCIA_DOLENCIAS",allocationSize=1)
public class Dolencias implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="secuencia_dolencias")
    private Integer id;
    @Lob
    @Column(name = "IMAGEN")
    private Serializable imagen;
    @Column(name = "FECHA")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "TEXTO")
    private String texto;
    @Column(name = "ATENDIDA")
    private Short atendida;
    @JoinColumn(name = "MEDICO", referencedColumnName = "DNI")
    @ManyToOne(optional = false)
    private Medicos medico;
    @JoinColumn(name = "PACIENTE", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Pacientes paciente;

    public Dolencias() {
    }

    public Dolencias(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Serializable getImagen() {
        return imagen;
    }

    public void setImagen(Serializable imagen) {
        this.imagen = imagen;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getTexto() {
        return texto;
    }

    public void setTexto(String texto) {
        this.texto = texto;
    }

    public Short getAtendida() {
        return atendida;
    }

    public void setAtendida(Short atendida) {
        this.atendida = atendida;
    }

    public Medicos getMedico() {
        return medico;
    }

    public void setMedico(Medicos medico) {
        this.medico = medico;
    }

    public Pacientes getPaciente() {
        return paciente;
    }

    public void setPaciente(Pacientes paciente) {
        this.paciente = paciente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dolencias)) {
            return false;
        }
        Dolencias other = (Dolencias) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "infb.modelo.Dolencias[id=" + id + "]";
    }

}
